
#include "adc.h"

struct rcc_apb_periph rcc_adc_apb[] =
{
    {
        2,
        RCC_APB2ENR_ADC1EN_Pos,
    },
    {
        2,
        RCC_APB2ENR_IOPAEN_Pos,
    },
    {
        0,0
    }
};

static struct rcc_adc_periph_clk rtc_clk=
{
    RCC_PERIPHCLK_ADC,
    RCC_ADCPCLK2_DIV6,
};

struct adc_device_data adc_data =
{
    &rcc_adc_apb[0],
    &rtc_clk,
    {
        GPIOA,
        GPIO_PIN_1,
        GPIO_MODE_ANALOG,
    },
    {
        ADC1,
        ADC_SCAN_DISABLE,
        DISABLE,
        DISABLE,
        ADC_SOFTWARE_START,
        ADC_DATAALIGN_RIGHT,
        1,
    },
    {
        ADC_CHANNEL_1,
        ADC_REGULAR_RANK_1,
        ADC_SAMPLETIME_7CYCLES_5,
    }
};

static struct device adc1_device={
    "/dev/adc1",
    "adc1",
     0,
    NULL,
    (sj_void *)&adc_data,
};

static DEVICE_MODULE_INIT(adc1_device)
